100 REM - DISKMAP - LIST-MECLOSE- A.R. PEPPER - MARCH 7, 1984 110 REM 120 REM USE BY NORMAL 130 REM LOAD 140 REM RUN 150 REM 160 REM IN RESPONSE TO 170 REM OUTPUT DEVICE ( 3 OR 4 ) ? 180 REM 3 MEANS ALL OUTPUT TO SCREEN 190 REM 4 MEANS MOST OUTPUT TO STANDARD PRINTER 200 REM 210 REM USUALLY YOU WANT TO REPLY 3 220 REM 230 REM 240 REM THE PROGRAM WILL THEN READ THE DIRECTORY OF THE DISK IN DRIVE 0 OF 250 REM DEVICE 8. IT WILL PRINT OUT A DIRECTORY LISTING, INCLUDING THE 260 REM INITIAL TRACK AND SECTOR OF EACH FILE. 270 REM 280 REM THEN IT READS EVERY BLOCK ON THE DISK, TO GET THE FIRST TWO BYTES 290 REM (IE FILE SYSTEM LINKS). TO KEEP THE USER AMUSED WHILE IT IS DOING THIS 300 REM IT PRINTS OUT (TO THE SCREEN) THE TRACK NUMBER IT IS WORKING ON. 310 REM 320 REM FOLLOWING THIS IT SUMMARIZES THE DIRECTORY. SOME INCONSISTENCIES IN 330 REM THE COUNTS CAN BE NOTED HERE BY THE USER. (THE PROGRAM COULD BE 340 REM MODIFIED TO MAKE SOME SPECIAL CHECKS OF THESE ITSELF). 350 REM 360 REM THEN THE PROGRAM LOOKS FOR INCONSISTENCIES IN DISK FILE STRUCTURE, 370 REM DESCRIBING ANY ERRORS IT FINDS. NOTE THAT IT GENERATES SOME 380 REM MESSAGES ABOUT HARMLESS CONDITIONS, SINCE IT TREATS "DEL*" FILES 390 REM AS FILES; THIS IS OFTEN USEFUL, BUT CAN BE ALARMING. I NEVER COULD 400 REM FIGURE OUT EXACTLY WHICH OPTIONS THE PROGRAM SHOULD HAVE REGARDING 410 REM THIS DETAIL. (IE YOU WANT TO BE ABLE TO PRINT OUT ERRORS IN "DEL*" 420 REM FILES CONDITIONALLY) 430 REM 440 REM A COMPLETE MAP OF THE DISK CAN BE PRINTED NEXT, WITH NEXT POINTERS 450 REM INDICATED FOR EACH BLOCK, AND BACK POINTERS TO REFERENCING BLOCKS 460 REM (UP TO 3) INDICATED FOR BLOCKS CONTAINED IN FILES IN THE DIRECTORY 470 REM (INCLUDING "DEL*" ENTRIES). 480 REM 490 REM THE MAP CAN BE SKIPPED BY ANSWERING THE QUESTION PRECEDING ITS 500 REM PRINTING APPROPRIATELY. THIS WAS FOR A LONG TIME ALL THE PROGRAM 510 REM DID; THE NEXT STEP DID NOT EXIST. REFLECTING NOW, THE COMPLETE 520 REM MAP, OR PORTIONS OF IT SHOULD BE MADE ONE OF THE INTERACTIVE 530 REM COMMANDS. 540 REM 550 REM AFTER PRINTING OR NOT PRINTING THE MAP, THE PROGRAM GOES INTO 560 REM INTERACTIVE EXAMINATION MODE. IT ALLOWS THE USER TO INSPECT THE 570 REM INCORE COPY OF THE DISK STRUCTURE. NOTE THAT OUTPUT ALWAYS SWITCHES 580 REM TO THE SCREEN INITIALLY WHEN INTERACTIVE MODE STARTS, BUT CAN BE 590 REM CHANGED TO THE PRINTER BY THE "O" COMMAND. 600 REM 610 REM ENTER "QUIT" TO QUIT GRACEFULLY, "H" FOR HELP OF SORTS. MOST COMMANDS 620 REM ARE A SINGLE LETTER (EXCEPT "QUIT"), AND SOME REQUIRE AN ARGUMENT 630 REM IMMEDIATELY FOLLOWING THEM. COMMAND LINES ARE INPUT AS STRINGS, 640 REM THEREFORE YOU CAN ENCLOSE THE ENTIRE LINE IN DOUBLE QUOTES TO ALLOW 650 REM THE STRING TO CONTAINS SPACES, COMMAS, ETC. 660 REM 670 REM MORE DETAILED DOCUMENTATION MAY FOLLOW. 680 REM 690 REM A NOTE ON THE "$" COMMAND. IT MAY BE USED AS EITHER "$" (GIVE A 700 REM COMPLETE DIRECTORY) OR "$" (SEARCH INCORE DIRECTORY FOR 710 REM GIVEN FILE, AND DISPLAYS FIRST BLOCK, SETTING CURRENT TRACK AND 720 REM SECTOR. (SORRY NO WILD CARDS YET, AND DON'T SPECIFY THE EXTENSION) 730 REM 740 REM 750 REM 760 REM MOST COMMANDS NO LONGER NEED THE DISK DRIVE AT ALL. HOWEVER, TWO 770 REM DO ALLOW THE USER TO MODIFY THE DISK BY DOING A BLOCK-ALLOCATE 780 REM AND A BLOCK-FREE. YOU SHOULD KNOW WHAT YOU'RE DOING IF YOU INTEND TO 790 REM USE THESE COMMANDS, ESPECIALLY BLOCK-FREE. 800 REM 810 REM NOTES: 820 REM USER INTERFACE IS VANILLA TENDING DOWNWARDS TO CRUDE. I ASSUME THE 830 REM WILL ALREADY HAVE CHOSEN SCREEN COLOURS HE FINDS PLEASING, AND USE 840 REM THE STREAM OUTPUT CONCEPT TO EASE SWITCHING BETWEEN THE SCREEN AND 850 REM PRINTER. IN FACT, THE PROGRAM COULD EASILY BE MODIFIED TO ALLOW 860 REM THE DIRECTION OF OUTPUT TO OTHER FILES/DEVICES. 870 REM 880 REM I USE AN 80 COLUMN "CARD", AND THIS IS SOMEWHAT EVIDENT, ESPECIALLY 890 REM IN THE "H" COMMAND OUTPUT. ALSO BLOCK DESCRIPTIONS WITH LONG FILE 900 REM NAMES LOOK QUITE MESSY. 910 REM 920 REM IN FACT, I DISCOVERED A BUG DUE TO THE LENGTH OF A PROMPT, WHICH 930 REM I HAVE FIXED FOR USE WITH 40 COLUMNS. 940 REM 950 REM 960 REM CAPACITY: 970 REM THE PROGRAM SHOULD BE ABLE TO ANALYZE ANY 1541 ETC DISK 980 REM 990 REM THE BASIC CODE OCCUPIES SLIGHTLY MORE THAN 10K BYTES. (FRE AFTER 1000 REM LOAD SHOWS ABOUT 28000 BYTES) 1010 REM 1020 REM LARGEST ARRAY IS APPROX 36*21*10*2 BYTES OR ABOUT 15K 1030 REM 3 OTHERS REPRESENT 3*36*21*2 OR ABOUT 5K 1040 REM 1050 REM THIS LEAVES ABOUT 8K FOR OTHER VARIABLES, STRINGS, PROGRAM EXPANSION 1060 REM ETC. OBSERVATIONS USING FREE AFTER RUNNING THE PROGRAM SHOW SLIGHTLY 1070 REM LESS THAN 5K BYTES. AT 20 BYTES VARIABLE STORAGE PER FILE FOR 1080 REM STORING THE NAME, THIS WOULD ALLOW OVER 200 FILES. THE LIMIT BOTH 1090 REM ON THE DISK (WITHOUT TRICKERY?) AND IN THE PROGRAM IS 144 FILES. 1100 REM AND I'D HATE TO MAINTAIN SUCH A DISK. AND THEY'D ALL BE PRETTY 1110 REM SMALL FILES. 1120 REM 1130 REM THE PROGRAM HAS RUN SUCCESSFULLY ON A TPUG UTILITY DISK WITH 64 1140 REM ENTRIES. THE PROGRAM USUALLY TAKES ABOUT TEN TO TWENTY MINUTES 1150 REM TO GET TO THE INTERACTIVE STAGE, WHAT WITH READING EVERY BLOCK, 1160 REM AND TRACING ALL FILES. THE MAP TAKES A LONG TIME TO PRINT, BUT 1170 REM AT LEAST THIS VERSION DOESN'T GET SUCH LONG GARBAGE COLLECTS AS 1180 REM A PREVIOUS VERSION WHICH USED A 35*21 STRING ARRAY (!) 1190 REM 1200 REM 1210 REM BY USING THIS PROGRAM IN CONJUNCTION WITH PONZO'S UTILITY, ONE 1220 REM CAN SOMETIMES LOCATE AND RECOVER DATA WHICH WOULD OTHERWISE BE 1230 REM LOST. IT IS ALSO INTERESTING TO SEE HOW DANGEROUS SITUATIONS DO 1240 REM ARISE IN THE FILE STRUCTURE FOR VARIOUS REASONS, AND IT CAN VERIFY 1250 REM THE WORK OF PROGRAMS BEING DEVELOPED TO MANIPULATE THE DISK. 1260 REM 1270 REM IN PRACTICE, HOWEVER, ALTHOUGH THEY MAY LOSE THE OCCASIONAL 1280 REM DOUBLY-ALLOCATED PROGRAM, IT IS PROBABLY SUFFICIENT FOR MORE PEOPLE 1290 REM JUST TO "VALIDATE" THEIR DISKS VERY REGULARLY.